import { makeAutoObservable } from "mobx";
class CountSlice {
  state = {
    count: 0,
  };
  constructor() {
    // 将类里面的所有数据变成响应式的
    makeAutoObservable(this);
  }
  increment(count) {
    this.state.count += count;
    console.log(this.state.count);
  }
  decrement(count) {
    this.state.count -= count;
  }
  incrementAsync(count) {
    setTimeout(() => {
      this.state.count += count;
    }, 2000);
  }
}

export default new CountSlice();
